﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace XNAGuiLib.GuiLibKeyboard
{
    public class Keyboards
    {
        // Enumeration for the different Keyboard Layouts
        #region Enumeration - KeyboardLayout
        public enum KeyboardLayout
        {
            EU_GE,
            US_NA
        }
        #endregion


        // European keyboard for german countries
        #region Static Keyboard - Europe - German
        private static char[][] _dict_eu_ge = new char[][] { 
                                new char[] {'A', 'a', 'a'}, new char[] {'B', 'b', 'b'},
                                new char[] {'C', 'c', 'c'}, new char[] {'D', 'd', 'd'}, new char[] {'E', 'e', '€'}, new char[] {'F', 'f', 'f'},
                                new char[] {'G', 'g', 'g'}, new char[] {'H', 'h', 'h'}, new char[] {'I', 'i', 'i'}, new char[] {'J', 'j', 'j'},
                                new char[] {'K', 'k', 'k'}, new char[] {'L', 'l', 'l'}, new char[] {'M', 'm', 'µ'}, new char[] {'N', 'n', 'n'},
                                new char[] {'O', 'o', 'o'}, new char[] {'P', 'p', 'p'}, new char[] {'Q', 'q', '@'}, new char[] {'R', 'r', 'r'},
                                new char[] {'S', 's', 's'}, new char[] {'T', 't', 't'}, new char[] {'U', 'u', 'u'}, new char[] {'V', 'v', 'v'},
                                new char[] {'W', 'w', 'w'}, new char[] {'X', 'x', 'x'}, new char[] {'Y', 'y', 'y'}, new char[] {'Z', 'z', 'z'},

                                new char[] {';', ',', ','}, new char[] {':', '.', '.'}, new char[] {'_', '-', '-'}, new char[] {' ', ' ', ' '},
                                new char[] {'Ä', 'ä', 'ä'}, new char[] {'Ü', 'ü', 'ü'}, new char[] {'Ö', 'ö', 'ö'}, new char[] {'*', '+', '~'},
                                new char[] {'`', '´', '´'}, new char[] {'\'', '#', '#'}, new char[] {'?', 'ß', '\\'}, new char[] {'°', '^', '^'},
                                new char[] {'>', '<', '|'},
                                
                                new char[] {'=', '0', '}'}, new char[] {'!', '1', '1'}, new char[] {'"', '2', '²'},
                                new char[] {'§', '3', '³'}, new char[] {'$', '4', '4'}, new char[] {'%', '5', '5'}, new char[] {'&', '6', '6'},
                                new char[] {'/', '7', '{'}, new char[] {'(', '8', '['}, new char[] {')', '9', ']'},
                                new char[] {'0', '0', '0'}, new char[] {'1', '1', '1'}, new char[] {'2', '2', '2'}, new char[] {'3', '3', '3'},
                                new char[] {'4', '4', '4'}, new char[] {'5', '5', '5'}, new char[] {'6', '6', '6'}, new char[] {'7', '7', '7'},
                                new char[] {'8', '8', '8'}, new char[] {'9', '9', '9'}, new char[] {'+', '+', '+'}, new char[] {'-', '-', '-'},
                                new char[] {'*', '*', '*'}, new char[] {'/', '/', '/'}
                                };
        /// <summary>
        /// gets the Character-based Keyboard Dictionary for Europe/German Keyboard-Layout
        /// </summary>
        public static char[][] Dictionary_Europe_German
        {
            get
            {
                return _dict_eu_ge;
            }
        }
        #endregion
        // US keyboard for english countries
        #region Static Keyboard - United States - North America
        private static char[][] _dict_us_na = new char[][] { 
                                new char[] {'A', 'a', 'a'}, new char[] {'B', 'b', 'b'},
                                new char[] {'C', 'c', 'c'}, new char[] {'D', 'd', 'd'}, new char[] {'E', 'e', 'e'}, new char[] {'F', 'f', 'f'},
                                new char[] {'G', 'g', 'g'}, new char[] {'H', 'h', 'h'}, new char[] {'I', 'i', 'i'}, new char[] {'J', 'j', 'j'},
                                new char[] {'K', 'k', 'k'}, new char[] {'L', 'l', 'l'}, new char[] {'M', 'm', 'm'}, new char[] {'N', 'n', 'n'},
                                new char[] {'O', 'o', 'o'}, new char[] {'P', 'p', 'p'}, new char[] {'Q', 'q', 'q'}, new char[] {'R', 'r', 'r'},
                                new char[] {'S', 's', 's'}, new char[] {'T', 't', 't'}, new char[] {'U', 'u', 'u'}, new char[] {'V', 'v', 'v'},
                                new char[] {'W', 'w', 'w'}, new char[] {'X', 'x', 'x'}, new char[] {'Y', 'y', 'y'}, new char[] {'Z', 'z', 'z'},


                                new char[] {'<', ',', ','}, new char[] {'>', '.', '.'}, new char[] {'|', '\\', '\\'}, new char[] {' ', ' ', ' '},
                                new char[] {'"', '\'', '\''}, new char[] {'{', '[', '['}, new char[] {':', ';', ';'}, new char[] {'}', ']', ']'},
                                new char[] {'+', '=', '='}, new char[] {'\\', '|', '|'}, new char[] {'_', '-', '-'}, new char[] {'~', '`', '`'},
                                new char[] {'|', '\\', '\\'},


                                new char[] {')', '0', '0'}, new char[] {'!', '1', '1'}, new char[] {'@', '2', '3'}, new char[] {'#', '3', '3'}, 
                                new char[] {'$', '4', '4'}, new char[] {'%', '5', '5'}, new char[] {'^', '6', '6'}, new char[] {'&', '7', '7'}, 
                                new char[] {'*', '8', '8'}, new char[] {'(', '9', '9'}, // End of number row 
                                new char[] {'0', '0', '0'}, new char[] {'1', '1', '1'}, new char[] {'2', '2', '2'}, new char[] {'3', '3', '3'},
                                new char[] {'4', '4', '4'}, new char[] {'5', '5', '5'}, new char[] {'6', '6', '6'}, new char[] {'7', '7', '7'},
                                new char[] {'8', '8', '8'}, new char[] {'9', '9', '9'}, new char[] {'+', '+', '+'}, new char[] {'-', '-', '-'},
                                new char[] {'*', '*', '*'}, new char[] {'/', '/', '/'}  // End of numberpad
                                };
        /// <summary>
        /// gets the Character-based Keyboard Dictionary for UnitedStates/NorthAmerica Keyboard-Layout
        /// </summary>
        public static char[][] Dictionary_UnitedStates_NorthAmerica
        {
            get
            {
                return _dict_us_na;
            }
        }
        #endregion


        // default keymap
        #region Static [Default] KeyMap - KeyMap
        private static Keys[] _keyMap = { 
                                #region A - Z-Keys
                                Keys.A, Keys.B, Keys.C, Keys.D, Keys.E, // A - E    [0 - 4]
                                Keys.F, Keys.G, Keys.H, Keys.I, Keys.J, // F - J    [5 - 9]
                                Keys.K, Keys.L, Keys.M, Keys.N, Keys.O, // K - O    [10-14]
                                Keys.P, Keys.Q, Keys.R, Keys.S, Keys.T, // P - T    [15-19]
                                Keys.U, Keys.V, Keys.W, Keys.X, Keys.Y, // U - Y    [20-24]
                                Keys.Z,                                 // Z        [25]
                                #endregion

                                #region Oem-Keys
                                Keys.OemComma,          // ; and ,      [26]
                                Keys.OemPeriod,         // : and .      [27]
                                Keys.OemMinus,          // _ and -      [28]
                                Keys.Space,             // 'whitespace' [29]                                
                                Keys.OemQuotes,         // Ä and ä      [30]
                                Keys.OemSemicolon,      // Ü and ü      [31]
                                Keys.OemTilde,          // Ö and ö      [32]
                                Keys.OemPlus,           // *, + and ~   [33]
                                Keys.OemCloseBrackets,  // ` and ´      [34]
                                Keys.OemQuestion,       // ' and #      [35]
                                Keys.OemOpenBrackets,   // ?, ß and \   [36]
                                Keys.OemPipe,           // ° and ^      [37]
                                Keys.OemBackslash,      // >, < and |   [38]
                                #endregion

                                #region D0 - D9-Keys
                                Keys.D0,                // =, 0 ans }   [39]
                                Keys.D1,                // ! and 1      [40]
                                Keys.D2,                // ", 2 and ²   [41]
                                Keys.D3,                // §, 3 and ³   [42]
                                Keys.D4,                // $ and 4      [43]
                                Keys.D5,                // % and 5      [44]
                                Keys.D6,                // & and 6      [45]
                                Keys.D7,                // /, 7 and {   [46]
                                Keys.D8,                // (, 8 and [   [47]
                                Keys.D9,                // ), 9 and ]   [48]
                                #endregion

                                #region Numpad0 - Numpad9-Keys
                                Keys.NumPad0,               // 0   [49]
                                Keys.NumPad1,               // 1   [50]
                                Keys.NumPad2,               // 2   [51]
                                Keys.NumPad3,               // 3   [52]
                                Keys.NumPad4,               // 4   [53]
                                Keys.NumPad5,               // 5   [54]
                                Keys.NumPad6,               // 6   [55]
                                Keys.NumPad7,               // 7   [56]
                                Keys.NumPad8,               // 8   [57]
                                Keys.NumPad9,               // 9   [58]
                                Keys.Add,                   // +   [59]
                                Keys.Subtract,              // -   [60]
                                Keys.Multiply,              // *   [61]
                                Keys.Divide,                // /   [62]
                                #endregion
                               };

        public static Keys[] KeyMap
        {
            get
            {
                return _keyMap;
            }
        }
        #endregion
    }
}
